package service;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import dao.ConvertRateDao;
import dao.SessionDetailDao;
import dao.impl.ConvertRateDaoImpl;
import dao.impl.SessionDetailDaoImpl;
import domain.ConvertRate;
import domain.SessionDetail;

import java.util.List;

public class SessionDetailService {
    String valueAsString = null;
    private SessionDetailDao contacts = new SessionDetailDaoImpl();
    public String ToJson(SessionDetail sessionDetail) {
        int userid = sessionDetail.getUserid();
        List<SessionDetail> list = contacts.SelectSessionDetail(userid);
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            valueAsString = objectMapper.writeValueAsString(list);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return valueAsString;
    }
}
